import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:mall/constant/app_colors.dart';
import 'package:mall/gen/r.dart';
import 'package:mall/ui/widgets/app_base_widgets/app_bottom_btn.dart';
import 'package:mall/ui/widgets/default_bg.dart';
import 'package:mall/ui/widgets/divider_line.dart';
import 'package:mall/utils/image_component/image_component.dart';

class AfterSalePage extends StatefulWidget {
  const AfterSalePage({super.key});

  @override
  State<AfterSalePage> createState() => _AfterSalePageState();
}

class _AfterSalePageState extends State<AfterSalePage> {
  final String? orderID = Get.arguments['orderID'];

  /// 备注输入控制器
  final TextEditingController remarkInputCtrl = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return APPScaffold(
      title: '申请售后',
      body: SingleChildScrollView(
        padding: EdgeInsets.all(15),
        child: Column(
          //退款总金额
          children: [_money(), SizedBox(height: 10), _resault()],
        ),
      ),
      bottomNavigationBar: BottomAppBar(
        color: Colors.transparent,
        child: AppBottomBtn(title: '提交', onTap: () {}),
      ),
    );
  }

  Container _resault() {
    return Container(
      height: 222,
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(10),
      ),
      padding: EdgeInsets.symmetric(horizontal: 15),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          //售后原因选择
          InkWell(
            child: Container(
              height: 50,
              child: Row(
                children: [
                  Text(
                    '售后原因',
                    style: TextStyle(color: AppColors.C_222222, fontSize: 15, fontWeight: FontWeight.bold),
                  ),
                  Spacer(),
                  Row(
                    children: [
                      Text(
                        '多拍/拍错',
                        style: TextStyle(color: AppColors.C_666666, fontSize: 12),
                      ),
                      SizedBox(width: 10),
                      ImageComponent(R.image.goTo.path, width: 7, height: 12),
                    ],
                  )
                ],
              ),
            ),
          ),
          DividerLineView(),
          //输入
          //输入内容
          Expanded(
            child: TextField(
              controller: remarkInputCtrl,
              maxLength: 200,
              maxLines: 10,
              style: TextStyle(
                color: AppColors.C_222222,
                fontSize: 13,
              ),
              decoration: InputDecoration(
                border: InputBorder.none,
                // counterText: '',
                hintText: '补充描述，有助于更好的处理售后问题(200字内)',
                hintStyle: TextStyle(
                  color: AppColors.C_999999,
                  fontSize: 13,
                ),
              ),
            ),
          ),

          SizedBox(height: 10),
          //添加图片
          //添加图片
          InkWell(
              child: ImageComponent(
            R.image.orderDetailShouhouAdd.path,
            size: 55,
          )),

          SizedBox(height: 20),
        ],
      ),
    );
  }

  Container _money() {
    return Container(
      height: 54,
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(10),
      ),
      padding: EdgeInsets.symmetric(horizontal: 15),
      child: Row(
        children: [
          Text(
            '退款总金额: ',
            style: TextStyle(color: AppColors.C_222222, fontSize: 15, fontWeight: FontWeight.bold),
          ),
          Text(
            '￥31',
            style: TextStyle(color: Color(0xffEC2010), fontSize: 15, fontWeight: FontWeight.bold),
          )
        ],
      ),
    );
  }
}
